//
/***********************************************************
             File name:      main.c
             Author:         Bitat (陆叁柒)
             Email :         Bitat@qq.com
             Gitee :         https://gitee.com/bitat
             CSDN  :         https://blog.csdn.net/bitat
             History:        2023/2/9
 ************************************************************/

#include <stdio.h>

int main(void)
{
    int n = 0, i = 0, j = 0;

    printf("请输入菱形的行数");
    scanf("%d", &n);

//打印菱形的上层
    for (i = 1; i <= n; i++)
    {
        for (j = i - n; j < n; j++)
        {
            printf(" ");
        }

        for (j = 1; j <= 2 * i - 1; j++)
        {
            printf("*");
        }

        printf("\n");
    }
//打印菱形的下层
    for (i = n - 1; i >= 0; i--)
    {
        for (j = i - n; j < n; j++)
        {
            printf(" ");
        }

        for (j = 1; j <= 2 * i - 1; j++)
        {
            printf("*");
        }

        printf("\n");
    }

    return 0;
}
